import subprocess

class GrubValidator:
    @staticmethod
    def validate_config():
        result = subprocess.run(
            ["sudo", "grub-mkconfig", "--test"],
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE
        )
        if result.returncode != 0:
            raise ValueError(f"配置校验失败: {result.stderr.decode()}")
        return True